/* 
 * File:   Label.cpp
 * Author: agu
 * 
 * Created on 29 de mayo de 2014, 15:45
 */

#include "client_Label.h"

Label::Label(const string path, SDL_Renderer* renderer, int x, int y):
back(renderer,path,x,y),message(renderer,x,y){
    this->text = NULL;
}

Label::~Label() {
    if (this->text != NULL) {
        delete this->text;
    }
}

void Label::setText(const string font, int size, Color color) {
    this->text = new Text(font, color, size);
}

void Label::setMessage(const string message) {   
    this->text->setMessage(message);
    Surface surface;
    this->text->copy(surface);
    this->message.load(surface);
}


void Label::render() {
    this->back.render();
    this->message.render(this->back.getX()+4,this->back.getY()+4,
            this->back.getWidth()-10,this->back.getHeight()-10);
}